
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>冻结IP</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="__PUBLIC__/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/layuiadmin/style/admin.css" media="all">
<body layadmin-themealias="default" style="">
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item" style="height: 20px;line-height: 20px;">
                <div class="layui-inline" style="margin-right: 0px;">
                     <span class="layui-breadcrumb">
                        <a href="">首页/冻结IP</a>
                        </span>
                </div>
                <div class="layui-inline" style="right: 0px;position: absolute;">
                    <a class="layui-btn layui-btn-small" style="line-height:20px;margin-top:-6px;float:right" href="javascript:location.replace(location.href);" title="刷新">
                        &nbsp;<i class="layui-icon layui-icon-refresh-3" style="line-height:18px;left: 12px;top:12px;"></i>&nbsp;
                    </a>
                </div>
            </div>
        </div>
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
                <div class="layui-inline" style="margin-right: 0px;">
                    <label class="layui-form-label">IP地址</label>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" placeholder=" 请输入IP地址" name="IP" maxlength="15" >
                    </div>
                </div>
                <div class="layui-inline" style="margin-right: 0px;">
                    <button class="layui-btn layuiadmin-btn-admin" lay-submit="" lay-filter="LAY-user-back-search">
                        冻结
                    </button>
                </div>
            </div>
        </div>

        <div class="layui-card-body">
            <table class="layui-table" lay-filter="admin_table" id="admin_table"></table>

            <script type="text/html" id="table-nickname">
                <a  style="font-size: 28px; border: none;" lay-event="free" title="解冻">
                    <i class='layui-icon layui-icon-password' style="color: red; font-size: 28px;"></i>
                </a>
            </script>

        </div>
    </div>
</div>

<script src="__PUBLIC__/layuiadmin/layui/layui.js"></script>
<script>
    function openWin(gameid,url) {
        layer.open({
            type: 2,
            title: '信息详情',
            shadeClose: true,
            shade: 0.8,
            maxmin: true,
            area: ['90%', '90%'],
            content: '/member/'+url+'?gameid='+gameid //iframe的url
        });
    }
    layui.config({
        base: '__PUBLIC__/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table'], function(){
        var $ = layui.$
            ,form = layui.form
            ,table = layui.table;

        $(".layuiadmin-btn-admin").on("click",function(){
            var IP = $("input[name=IP]").val();
            layer.msg('正在发送冻结IP的请求，请稍后。。', {icon: 16,shade:0.5,time:1000,end:function () {
                    $.ajax({
                        type:"post",
                        datatype:"json",
                        url:'/freeze/freeip',
                        data:{ip:IP},
                        success:function (data) {
                            console.log(data);
                            if(data['code'] == 0){
                                layer.msg(data['msg'],{icon: 5});
                            }else{
                                layer.msg(data['msg'],{icon: 1,time:1000,end:function () {
                                        layui.table.reload("admin_table");
                                 }});
                            }

                        },
                        error:function () {
                            layer.msg("发错错误",{icon: 5})
                        }
                    });
                }
            });
        });


        table.render({
            elem: '#admin_table'
            ,url: '/Freeze/getlistip' //数据接口
            ,title: '游戏详情'
            ,loading:true
            ,page: true //开启分页
            ,cols: [[ //表头
                { title: '冻结状态', width:160,align:'center',toolbar: '#table-nickname'}
                ,{field: 'address', align:'center', title: 'IP地址', width:200}
                ,{field: 'enjoinoverdate', title: '冻结时间'}

            ]]
            ,done:function (res) {

            }
        });


        //监听行工具事件
        table.on('tool(admin_table)', function(obj){
            var data = obj.data;
            var id = data.address;
            //解冻
            if(obj.event === 'free'){
                // alert(1);
                layer.msg('正在发送解冻请求，请稍后。。', {icon: 16,shade:0.5,time:1000,end:function () {
                        $.ajax({
                            type:"GET",
                            datatype:"json",
                            url:'/Freeze/nofree?id='+ id+'&type=4',
                            success:function (data) {
                                console.log(data);
                                if(data['code'] == 0){
                                    layer.msg(data['msg'],{icon: 5});
                                }else{
                                    layer.msg('解冻操作成功',{icon: 1});
                                    // layui.table.reload("admin_table");
                                }

                            },
                            error:function () {
                                layer.msg("发错错误",{icon: 5})
                            }
                        });
                    }});
            }else if(obj.event === 'nofree'){ //冻结
                var str=prompt("备注","");
                layer.msg('正在发送冻结请求，请稍后。。', {icon: 16,shade:0.5,time:1000,end:function () {
                        $.ajax({
                            type:"GET",
                            datatype:"json",
                            url:'/Member/disablelogin/id/'+ id+'/content/'+str,
                            success:function (data) {
                                if(data['code'] == 0){
                                    layer.msg(data['msg'],{icon: 5});
                                }else{
                                    layer.msg('操作成功',{icon: 1});
                                    layui.table.reload("admin_table");
                                }

                            },
                            error:function () {
                                layer.msg("发错错误",{icon: 5})
                            }
                        });
                    }});
            }
        });
    });
</script>
</body>
</html>


<!--
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">

    <title>冻结IP</title>

    <meta name="keywords" content="">
    <meta name="description" content="">

    &lt;!&ndash;[if lt IE 9]>
    <![endif]&ndash;&gt;

    <link rel="shortcut icon" href="{$Think.const.RESOURCE}img/favicon.ico">
    <link href="{$Think.const.RESOURCE}css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="{$Think.const.RESOURCE}css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.const.RESOURCE}css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="{$Think.const.RESOURCE}css/animate.css" rel="stylesheet">
    <link href="{$Think.const.RESOURCE}css/style.css?v=4.1.0" rel="stylesheet">
    <script type="text/javascript" src="__PUBLIC__/home/js/jquery-3.2.1.min.js"></script>
    <style>
        :-moz-placeholder { /* Mozilla Firefox 4 to 18 */
            color: #b6b6b6; opacity:1;
        }

        ::-moz-placeholder { /* Mozilla Firefox 19+ */
            color: #b6b6b6;opacity:1;
        }

        input:-ms-input-placeholder{
            color: #b6b6b6;opacity:1;
        }

        input::-webkit-input-placeholder{
            color: #b6b6b6;opacity:1;
        }
    </style>
</head>

<body class="fixed-sidebar full-height-layout gray-bg">


<div class="wrapper wrapper-content  animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">



            <div class="ibox">
                <div class="ibox-content">

                    <form action="{:U('freeze/getip')}" method="post" >
                        <div class="row">
                            <div class="col-md-4 form-group">
                                <div class="input-group m-b ">
                                    <span class="input-group-addon ">IP地址</span>
                                    <input type="text" value="" placeholder=" 请输入IP地址" name="IP" maxlength="15" value="" class="form-control text-info">
                                </div>
                            </div>
                            <div class="col-md-3">
                                <button type="submit" class="btn btn btn-primary col-xs-3 col-md-offset-1">冻结 </button>&nbsp;

                            </div>
                            <div style="margin-right: 0px; border: 1px red; position: relative;text-align: left">
                                <a href="{:U('freeze/getip')}" class="btn btn btn-primary " style="width: 80px; position: absolute; right: 15px;"> <i class="fa fa-refresh col-md-offset-2"></i> 刷新 </a>
                            </div>
                        </div>
                    </form>
                    <br>
                    <h2>查询结果</h2>
                    <style>
                        #button4 span{
                            margin-top: 20px;

                        }
                        .clients-list .strong{
                            font-size: 2em;
                        }
                    </style>
                    <div class="clients-list">
                        <ul class="nav nav-tabs">
                            <span class=" small text-muted">总共 :  <span class="text-success strong"> {$count}</span>  条记录</span>
                            &lt;!&ndash;<span class="pull-right small text-muted">{$number} 条记录</span>&ndash;&gt;
                            &lt;!&ndash;<li class="active"><a data-toggle="tab" href="clients.html#tab-1"><i class="fa fa-user"></i> Contacts</a></li>&ndash;&gt;
                            &lt;!&ndash;<li class=""><a data-toggle="tab" href="clients.html#tab-2"><i class="fa fa-briefcase"></i> Companies</a></li>&ndash;&gt;
                        </ul>
                        <div class="tab-content">
                            <div id="tab-1" class="tab-pane active">
                                <div class="full-height-scroll">
                                    <div class="table-responsive">
                                        <table class="table table-bordered table-striped table-hover ">
                                            <thead>
                                            <tr>
                                                <th></th>
                                                <th>IP地址</th>
                                                <th>冻结时间</th>
                                            </tr>
                                            </thead>

                                            <tbody>
                                            <volist name="lists" id="vo">
                                                <tr>
                                                    <td class="" style="width:12px">
                                                        <a onclick="openWin('{$vo.AddrString}')">
                                                            <i class="fa fa-eye text-danger"></i>解冻
                                                            &lt;!&ndash;<i class="fa fa-trophy text-info"></i>&ndash;&gt;
                                                        </a>
                                                    </td>
                                                    <td class="contact-type" style="border-left: 1px solid #DDDDDD">{$vo.AddrString}</td>
                                                    <td class="contact-type" style="border-left: 1px solid #DDDDDD">{$vo.EnjoinOverDate}</td>
                                                </tr>
                                            </volist >

                                            </tbody>
                                        </table>

                                        <script>
                                            function openWin(accountid) {
                                                $.ajax({
                                                     type:"post",
                                                     datatype:"json",
                                                     url:"{:U('freeze/deleteIp')}",
                                                     data:{data:accountid},
                                                     success:function (data) {
                                                        if(data){
                                                            alert("解冻成功");
                                                            window.location.reload();
                                                        }else{
                                                            alert("解冻失败,你没有相关权限");
                                                        }
                                                     },
                                                     error:function () {
                                                         alert("发生错误");
                                                     }
                                                 });
                                            }
                                        </script>
                                    </div>
                                    <div class=" row text-center contact-type page_show">
                                        <style>
                                            .page_show{
                                                width: 100%;
                                                margin-top:30px;
                                            }
                                            .page_show a{
                                                padding: 16px 22px;
                                            }
                                            .page_show a:hover{
                                                background-color: #18a689;
                                                border-radius: 30px;
                                                color: #ffffff;
                                            }
                                            .page_show .current{
                                                padding: 20px;
                                            }
                                        </style>
                                        &lt;!&ndash;//{$page_show}&ndash;&gt;
                                        <volist name="page_show" id="vo">
                                            <a href="{:U('freeze/getip')}?p={$vo}" class="num">{$vo}</a>
                                        </volist>
                                        当前页：<span class=" text-danger">{$p}</span>
                                    </div>
                                </div>
                            </div>

                        </div>



                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


&lt;!&ndash; 全局js &ndash;&gt;
<script src="{$Think.const.RESOURCE}js/jquery.min.js?v=2.1.4"></script>
<script src="{$Think.const.RESOURCE}js/bootstrap.min.js?v=3.3.6"></script>
&lt;!&ndash;<script src="{$Think.const.RESOURCE}js/plugins/metisMenu/jquery.metisMenu.js"></script>&ndash;&gt;
&lt;!&ndash;<script src="{$Think.const.RESOURCE}js/plugins/slimscroll/jquery.slimscroll.min.js"></script>&ndash;&gt;
&lt;!&ndash;<script src="{$Think.const.RESOURCE}js/plugins/layer/layer.min.js"></script>&ndash;&gt;

&lt;!&ndash;&lt;!&ndash; 自定义js &ndash;&gt;&ndash;&gt;
&lt;!&ndash;<script src="{$Think.const.RESOURCE}js/hplus.js?v=4.1.0"></script>&ndash;&gt;
&lt;!&ndash;<script type="text/javascript" src="{$Think.const.RESOURCE}js/contabs.js"></script>&ndash;&gt;
<script type="text/javascript" src="{$Think.const.RESOURCE}js/content.js"></script>

&lt;!&ndash;&lt;!&ndash; 第三方插件 &ndash;&gt;&ndash;&gt;
&lt;!&ndash;<script src="{$Think.const.RESOURCE}js/plugins/pace/pace.min.js"></script>&ndash;&gt;
&lt;!&ndash;<script src="{$Think.const.RESOURCE}js/plugins/sweetalert/sweetalert.min.js"></script>&ndash;&gt;

</body>

</html>
-->
